// pages/change_account.js
var reqHelp = require('../../utils/reqHelp.js');
const app = getApp()
Page({

    /**
     * 页面的初始数据
     */
    data: {
        accountList:[],
        seletedId: 0,
    },
    onLoad(option){
        
        const eventChannel = this.getOpenerEventChannel()
        const id = wx.getStorageSync('cardId')
        console.log(id)
        eventChannel.on('acceptDataFromOpenerPage', (data)=> {
            this.setData({
                accountList:data.data,
                seletedId:id
            })
        })
    },
    // 切换账号
    changeId(e){
        const  id = e.currentTarget.dataset.id;
        wx.setStorageSync('cardId', id)
        this.setData({seletedId:id})
        wx.navigateBack({
          url: '../index/index?cardId='+id,
        })
    }
})